package us.codecraft.webmagic.lyon.liuhecai;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;
import us.codecraft.webmagic.selector.Html;
import us.codecraft.webmagic.selector.Selectable;

/**
 * Created by Administrator on 2017/6/10.
 */

public class DZHProcesso implements PageProcessor {
    public void process(Page page) {

        Html html = page.getHtml();
        Selectable selectable = html.xpath("div[@class='bd']");
        Selectable selectable1 = selectable.xpath("//tr[@class='infolist']");
        Selectable liuPingma = selectable1.xpath("//div[@class='sortDown clearfix']");
        Selectable tema = selectable1.xpath("//td[@class='bg-high2']//div[@class='p']");


        Selectable regex = liuPingma.regex("(\\d+){1}");
        Selectable regex1 = tema.regex("(\\d+){1}");
        System.out.println(regex);
    }

    @Override
    public Site getSite() {
        return Site.me();
    }

    public static void main(String[] args) {
        Spider.create(new DZHProcesso()).test("https://www.dzh.vip/kj/kjjl/2016.html");
    }
}
